class UE
{
	//UE属性相关
	int id;
	double posX;												//UE的X坐标
	double posY;												//UE的Y坐标
	int speed;													//UE的移动速度
	int jiaodu;													//UE的移动方向
	
	//信号强度相关
	double MacroBsRSS;											//UE接收到蜂窝基站的信号强度
	double[] FemtocellBsRSS = new double[20];					//UE接收到FAP的信号强度列表
	
	//业务相关
	boolean dataService;										//数据服务标志
	boolean voiceService;										//语音服务标志
	int serviceTime;											//UE要求的服务时间 单位是s
	
	//切换状态相关
	int[] handoverEndTime = new int[21];						//保存每一次切换成功结束的时间		
	boolean requestFlag;										//切换请求标志
	
	//链接状态相关
	boolean connectToMacrocellFlag;								//是否链接到基站
	boolean connectToFemtocellFlag;								//是否链接到FAP
	int connectToFAPID;											//如果链接到的是FAP，那么记录下ID
	
	
	public void setPosition(double UEposX, double UEposY)		//设定UE的位置
	{
		this.posX = UEposX;
		this.posY = UEposY;	
	}
	
	public void setID(int UEID)									//设置UE的ID
	{
		this.id = UEID;
	}
	public void setSpeed(int speed)								//设定速度
	{
		this.speed = speed;	
	}

	public void setJiaodu(int jiaodu)							//设定方向
	{
		this.jiaodu = jiaodu;	
	}

	

	public void getMacroBsRSS(MacrocellBs bs)					//活得基站的信号强度
	{
		double tempX;
		double tempY;

		tempX = Math.pow(this.posX - bs.posX, 2);
		tempY = Math.pow(this.posY - bs.posY, 2);
		
		double distanceUeAndStation = Math.pow(tempX + tempY, 0.5);
		
		if(distanceUeAndStation <= bs.radius)
		{
			this.MacroBsRSS = Math.pow(tempX + tempY, 0.5);
		}
		else
			this.MacroBsRSS = 0;
	}

	public void getFemtocellBsRSS(MacrocellBs bs)			//获得FAP的信号强度
	{
		double tempX;
		double tempY;

		tempX = Math.pow(this.posX - bs.posX, 2);
		tempY = Math.pow(this.posY - bs.posY, 2);
		
		double distanceUeAndStation = Math.pow(tempX + tempY, 0.5);
		if(distanceUeAndStation <= bs.radius)
		{
				this.FemtocellBsRSS[bs.id] = Math.pow(tempX + tempY, 0.5);
		}
		else
				this.FemtocellBsRSS[bs.id] = 0;
	}	
	
	public void requestHandover(boolean requestFlag)			//发出切换请求
	{
		this.requestFlag = requestFlag;
	}
}
